import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
import { resolve } from 'path';


// https://vitejs.dev/config/
export default defineConfig({
    server: {
        open: false, // 配置自动启动浏览器
        port: 11205,
        host: '0.0.0.0',
        proxy: {
            '/api': {
                target: 'https://quantumai.love',// 后台接口域名
                changeOrigin: true, // 是否允许跨域
                secure: true,
                // rewrite: (path) => path.replace(/^\/api/, '') // api标志替换为'
            }
        }
    },
    build: {
        outDir: "liang-zi-ai-dapp-online"
    },
    css: {
        preprocessorOptions: {
            less: {
                javascriptEnabled: true
            }
        }
    },
    plugins: [
        vue(),
        Components({
            resolvers: [VantResolver()],
        }),
    ],
    resolve: {
        // 设置文件./src路径为 @
        alias: [
            {
                find: '@',
                replacement: resolve(__dirname, './src')
            }
        ]
    },
})
